import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:simple_pwd_node/model/record_model.dart';
import 'package:simple_pwd_node/pages/add_new.dart';
import 'package:simple_pwd_node/pages/unlock.dart';
import './pages/home.dart';

void main() {
  runApp(ChangeNotifierProvider(
    create: (BuildContext ctx){
      return new RecordModel();
    },
    child: MyApp(),
  ));
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    print('********MyApp_build************');
    Provider.of<RecordModel>(context, listen: false).update();
    return MaterialApp(
        title: '简单密码',
        debugShowCheckedModeBanner: false,
        theme: ThemeData.light(),
        routes: {
          '/mainPage': (ctx) => Home(),
          '/addNew':(ctx) => AddNewPage(),
          '/unlock':(ctx) => UnLockPage()
        },
        home: UnLockPage());
  }
}
